<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('入驻培训机构管理信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>所在省市：</label>

                                <select th:each="provinces : ${citys}" id="prvovinces" name="itProvince" onchange="provinceschange()">
                                    <option value="">--请选择--</option>
                                    <option  th:value="${provinces.cId}"  th:text="${provinces.cName}"></option>
                                </select>

                                <select th:each="provinces : ${citys}" id="city" name="itCity" onchange="citychange()">
                                    <option value="">--请选择--</option>
                                    <div  th:each="city : ${provinces.children}">
                                        <option style="display: none;" class="cc" th:classappend="${city.fId}" th:value="${city.cId}"  th:text="${city.cName}"></option>
                                    </div>
                                </select>

                                <select th:each="provinces : ${citys}" id="region" name="itArea">
                                    <option value="">--请选择--</option>
                                    <div  th:each="city : ${provinces.children}">
                                        <div th:each="region : ${city.children}">
                                            <option style="display: none;" class="rr" th:classappend="${region.fId}" th:value="${region.cId}"  th:text="${region.cName}"></option>
                                        </div>
                                    </div>

                                </select>
                            </li>
                            <li>
                                <label>机构名称：</label>
                                <input type="text" name="itName"/>
                            </li>
                            <li>
                                <label>联系人：</label>
                                <input type="text" name="itLiaison"/>
                            </li>
                            <li>
                                <label>联系电话：</label>
                                <input type="text" name="itPhone"/>
                            </li>
                            <li>
                                <label>审核状态：</label>
                                <select name="itStatus">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
                            <li>
                                <label>入驻时间：</label>
                                <input type="text" class="time-input" placeholder="请选择入驻时间" name="time"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="itsystem:institution:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="itsystem:institution:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="itsystem:institution:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="itsystem:institution:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('itsystem:institution:edit')}]];
        var removeFlag = [[${@permission.hasPermi('itsystem:institution:remove')}]];
        var prefix = ctx + "itsystem/institution";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove/{id}",
                exportUrl: prefix + "/export",
                modalName: "入驻培训机构管理信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'itId',
                    title: '标识ID',
                    visible: false
                },
                {
                    field: 'itName',
                    title: '机构名称'
                },
                {
                    field: 'itLiaison',
                    title: '联系人'
                },
                {
                    field: 'itPhone',
                    title: '联系电话'
                },
                {
                    field: 'itGps',
                    title: '所在经纬度'
                },
                {
                    field: 'itStatus',
                    title: '审核状态'
                },
                {
                    field: 'itViews',
                    title: '浏览量'
                },
                {
                    field: 'itFollow',
                    title: '关注量'
                },
                {
                    field: 'time',
                    title: '入驻时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        //favicon.ico:1 Failed to load resource: the server responded with a status of 404 ()
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.itId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.itId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


        function provinceschange() {
            var value = $("#prvovinces").val();
            $(".cc").hide();
            $(".rr").hide();

            $("#city").val("");
            $("#region").val("");
            $("." + value).show();

        }

        function citychange() {
            var value = $("#city").val();
            $(".rr").hide();
            $("#region").val("");
            $("." + value).show();
        }

    </script>
</body>
</html>